<html>

<head>
<meta name=标题 content="">
<meta name=关键词 content="">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:"Courier New";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Times;
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:DengXian;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@DengXian";}
@font-face
	{font-family:"Microsoft YaHei";
	panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
	{font-family:Menlo;
	panose-1:2 11 6 9 3 8 4 2 2 4;}
@font-face
	{font-family:"\@Microsoft YaHei";}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:12.0pt;
	font-family:DengXian;}
code
	{font-family:Courier;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:21.0pt;
	font-size:12.0pt;
	font-family:DengXian;}
p.a, li.a, div.a
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	line-height:200%;
	font-size:12.0pt;
	font-family:"Microsoft YaHei";}
.MsoChpDefault
	{font-family:DengXian;}
 /* Page Definitions */
@page WordSection1
	{size:595.0pt 842.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-size:14.0pt;line-height:200%;font-family:"Microsoft YaHei"'>file</span></b></p>

<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
text-indent:21.0pt;line-height:200%;text-autospace:none'><span
style='font-family:"Microsoft YaHei";color:black;vertical-align:sub'>判断指定文件的文件类型，它依据文件内容判断，并不依据扩展名。此命令的适用范围：<span
lang=EN-US>RedHat</span>、<span lang=EN-US>RHEL</span>、<span lang=EN-US>Ubuntu</span>、<span
lang=EN-US>CentOS</span>、<span lang=EN-US>SUSE</span>、<span lang=EN-US>openSUSE</span>、<span
lang=EN-US>Fedora</span>。</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>1</span></b><b><span style='font-family:
"Microsoft YaHei"'>、语法</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>file  [</span></b><b><span
style='font-family:"Microsoft YaHei"'>选项<span lang=EN-US>]  filename</span></span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><b><span
lang=EN-US style='font-family:"Microsoft YaHei"'>&nbsp;</span></b></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>2</span></b><b><span style='font-family:
"Microsoft YaHei"'>、选项列表</span></b></p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>选项</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border:solid windowtext 1.0pt;
  border-left:none;background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>说明</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-v | --version</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示命令版本信息</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--help</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>显示帮助文档</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-b | --brief</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>列出结果的时候，不显示文件名</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-C | --compile</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>编写一个<span
  lang=EN-US>magic.mgc</span>输出文件，其中包含魔术文件或目录的预解析版本</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-c | --checking-printout</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>以检查魔术文件的解析形式的打印输出。这通常与<span
  lang=EN-US>-m</span>标志一起使用，用于在安装新的魔术文件之前调试它。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-e | --exclude testname</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>从确定文件类型的测试列表中排除在<span
  lang=EN-US>testname</span>中指定的测试。有效的测试名称是：</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>apptype</span><span style='font-family:
  "Microsoft YaHei"'>，<span lang=EN-US>EMX</span>应用程序类型<span lang=EN-US>(</span>仅在<span
  lang=EN-US>EMX</span>上<span lang=EN-US>)</span>。</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>text</span><span style='font-family:
  "Microsoft YaHei"'>，各种类型的文本文件<span lang=EN-US>(</span>此测试将尝试猜测文本编码，而不管<span
  lang=EN-US>“</span>编码<span lang=EN-US>”</span>选项的设置如何<span lang=EN-US>)</span></span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>encoding</span><span style='font-family:
  "Microsoft YaHei"'>，用于软魔术测试的不同文本编码</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>tokens</span><span style='font-family:
  "Microsoft YaHei"'>，在文本文件中查找已知的令牌</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>cdf</span><span style='font-family:
  "Microsoft YaHei"'>，打印复合文档文件的详细信息</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>compress</span><span style='font-family:
  "Microsoft YaHei"'>，检查并查看压缩文件</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>elf</span><span style='font-family:
  "Microsoft YaHei"'>，打印<span lang=EN-US>ELF</span>文件的细节。</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>soft</span><span style='font-family:
  "Microsoft YaHei"'>，查阅魔法档案。</span></p>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>tar</span><span style='font-family:
  "Microsoft YaHei"'>，检查<span lang=EN-US>tar</span>文件</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-F | --separator</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>指定文件名和结果之间的分隔符，默认：</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-f namefile | --files-from namefile</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>从给定的文件中，读取文件名，然后操作</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-h | --no-dereference</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>选项导致符号链接不被遵循<span
  lang=EN-US>(</span>在支持符号链接的系统上<span lang=EN-US>)</span>。如果没有定义环境变量<span
  lang=EN-US>POSIXLY_TRIDER</span>，则这是默认的</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-i | --mime</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>导致文件命令输出<span
  lang=EN-US>MIME</span>类型字符串，而不是更传统的人类可读的字符串。因此，它可以说<span lang=EN-US>‘text/plain;</span>；<span
  lang=EN-US>charset=us-ascii’</span>而不是<span lang=EN-US>‘ASCII</span>文本<span
  lang=EN-US>’</span>。为了使此选项工作，文件更改了它处理命令本身识别的文件的方式<span lang=EN-US>(</span>例如许多文本文件类型、目录等<span
  lang=EN-US>)</span>，并使用了另一个<span lang=EN-US>“</span>魔术<span lang=EN-US>”</span>文件。<span
  lang=EN-US>(</span>见下文档案部分<span lang=EN-US>)</span></span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>--mime-type | --mime-encoding</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>类似<span
  lang=EN-US>-i</span>，但只打印指定的元素。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>k | --keep-going</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>第一次匹配别停，继续。随后的匹配将具有字符串<span
  lang=EN-US>‘\012-’</span>。<span lang=EN-US>(</span>如果需要换行符，请参见<span
  lang=EN-US>‘-r’</span>选项。<span lang=EN-US>)</span></span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-L | --dereference</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>选项导致符号链接被遵循，就像<span
  lang=EN-US>ls(1)</span>中的同名选项<span lang=EN-US>(</span>在支持符号链接的系统上<span
  lang=EN-US>)</span>。如果定义了环境变量<span lang=EN-US>POSIXLY_TRIDER</span>，则这是默认的</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-m | --magic-file magicfiles</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>指定包含魔术的文件和目录的备用列表。这可以是单个项目，也可以是冒号分隔的列表。如果在文件或目录旁边找到已编译的魔术文件，则将使用它。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-N | --no-pad</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>让文件名在输出中对齐<span
  lang=EN-US>                           </span></span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-n | --no-buffer</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>检查每个文件后，强迫<span
  lang=EN-US>stdout</span>被刷新。这只有在检查文件列表时才有用。它用于希望从管道输出文件类型的程序。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-p | --preserve-date</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>在支持<span
  lang=EN-US>utime(2)</span>或<span lang=EN-US>utime(2)</span>的系统上，尝试保留分析过的文件的访问时间，假装文件从未读取过它们。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-r | --raw</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>不要将不可打印的字符翻译为<span
  lang=EN-US>\ooo</span>。通常，文件将不可打印的字符转换为它们的八进制表示形式</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='font-family:"Microsoft YaHei"'>-s
  | --special-files</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>通常，文件只尝试读取和确定<span
  lang=EN-US>STAT(2)</span>报告是普通文件的参数文件的类型。这可以防止出现问题，因为读取特殊文件可能会产生特殊的后果。指定<span
  lang=EN-US>-s</span>选项会导致<span lang=EN-US>file</span>也读取参数文件，这些参数文件是块文件或字符特殊文件。这对于确定原始磁盘分区中数据的文件系统类型非常有用，这些分区是块特殊文件。此选项还会导致文件忽略<span
  lang=EN-US>stat(2)</span>所报告的文件大小，因为在某些系统上，它报告原始磁盘分区的大小为零。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='font-family:"Microsoft YaHei"'>-z
  | --uncompress</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>试着查看压缩文件</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='font-family:"Microsoft YaHei"'>-0
  | --print0</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>在文件名结束后输出空字符<span
  lang=EN-US>‘\0’</span>。很好地削减了产量。这不影响仍然打印的分隔符。</span></p>
  </td>
 </tr>
 <tr>
  <td width="28%" valign=top style='width:28.58%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span lang=EN-US
  style='font-family:"Microsoft YaHei"'>-z</span></p>
  </td>
  <td width="71%" valign=top style='width:71.42%;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal style='line-height:200%'><span style='font-family:"Microsoft YaHei"'>尝试读取压缩文件的内容</span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>&nbsp;</span></b></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>3</span></b><b><span style='font-family:
"Microsoft YaHei"'>、说明</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>file</span><span
style='font-family:"Microsoft YaHei"'>对每个参数进行测试，试图对其进行分类。按照这个顺序执行的测试有三组：文件系统测试、魔术测试和语言测试。成功的第一个测试将导致打印文件类型。打印的类型通常包含一个单词<span
lang=EN-US>text(</span>该文件只包含打印字符和几个常见的控制字符，并可能安全地在<span lang=EN-US>ASCII</span>终端上读取<span
lang=EN-US>)</span>、<span lang=EN-US>executable (</span>该文件包含以某种<span
lang=EN-US>UNIX</span>内核可以理解的形式编译程序的结果<span lang=EN-US>)</span>，或包含任何其他含义的<span
lang=EN-US>data(</span>数据通常是<span lang=EN-US>“</span>二进制<span lang=EN-US>”</span>或不可打印的<span
lang=EN-US>)</span>。异常是众所周知的包含二进制数据的文件格式<span lang=EN-US>(</span>核心文件、<span
lang=EN-US>tar</span>存档<span lang=EN-US>).</span>在修改魔术文件或程序本身时，请确保保留这些关键字。用户依赖于知道目录中的所有可读文件都打印了单词<span
lang=EN-US>“text”</span>。不要像<span lang=EN-US>Berkeley</span>那样，把<span
lang=EN-US>“shell</span>命令文本<span lang=EN-US>”</span>改为<span lang=EN-US>“shell</span>脚本<span
lang=EN-US>”</span></span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>文件系统测试基于检查<span lang=EN-US>STAT(2)</span>系统调用的返回。该程序检查该文件是否为空文件，或是否为某种特殊文件。如果在系统头文件中定义了适合您正在运行的系统的任何已知文件类型<span
lang=EN-US>(</span>套接字、符号链接或有名管道<span lang=EN-US>)</span>，则会直观地显示它们。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>魔术测试用于检查具有特定固定格式的数据的文件。这方面的典型示例是二进制可执行文件<span
lang=EN-US>(</span>已编译的程序<span lang=EN-US>)a.out</span>文件，其格式在标准<span
lang=EN-US>include</span>目录中的<span lang=EN-US>#include&lt;a.out.h&gt;</span>中定义，或者<span
lang=EN-US>#include &lt;exec.h&gt;</span>。这些文件具有一个<span lang=EN-US>“</span>魔术号<span
lang=EN-US>”</span>，存储在文件开头附近的某个特定位置，该位置告诉<span lang=EN-US>UNIX</span>操作系统该文件是二进制可执行文件，以及其中的几种类型中的哪一种。<span
lang=EN-US>“</span>魔术<span lang=EN-US>”</span>的概念已经通过扩展应用于数据文件。任何在一个小的固定偏移量处具有一些不变标识符的文件通常都可以用这种方式来描述。标识这些文件的信息是从已编译的魔术文件<span
lang=EN-US>/usr/share/misc/magic.mgc</span>中读取的，如果编译的文件不存在，则从<span lang=EN-US>/usr/share/misc/magc</span>目录中读取这些文件。此外，如果<span
lang=EN-US>$HOME/.magic.mgc</span>或<span lang=EN-US>$home/.magic</span>存在，则它将优先用于系统魔术文件。如果<span
lang=EN-US>/etc/magic</span>存在，它将与其他魔术文件一起使用。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>如果文件与魔术文件中的任何条目不匹配，则检查它是否为文本文件。<span
lang=EN-US>ASCII</span>、<span lang=EN-US>ISO-8859-x</span>、非<span lang=EN-US>ISO
8</span>位扩展<span lang=EN-US>-ASCII</span>字符集<span lang=EN-US>(</span>例如在<span
lang=EN-US>Macintosh</span>和<span lang=EN-US>IBM PC</span>系统上使用的字符集<span
lang=EN-US>)</span>、<span lang=EN-US>UTF-8</span>编码<span lang=EN-US>Unicode</span>、<span
lang=EN-US>UTF-16</span>编码<span lang=EN-US>Unicode</span>和<span lang=EN-US>EBCDIC</span>字符集可以通过构成每组可打印文本的不同范围和字节序列来区分。如果一个文件通过了这些测试中的任何一个，就会报告它的字符集。<span
lang=EN-US>ASCII</span>、<span lang=EN-US>ISO-8859-x</span>、<span lang=EN-US>UTF-8</span>和<span
lang=EN-US>Extended-ASCII</span>文件被识别为<span lang=EN-US>“Text”</span>，因为它们在几乎任何终端上都是可读的；<span
lang=EN-US>UTF-16</span>和<span lang=EN-US>EBCDIC</span>仅仅是<span lang=EN-US>“</span>字符数据<span
lang=EN-US>”</span>，因为它们包含文本，但是文本需要翻译才能被读取。此外，文件将试图确定文本类型文件的其他特征<span
lang=EN-US>.</span>如果文件的行被<span lang=EN-US>CR</span>、<span lang=EN-US>CRLF</span>或<span
lang=EN-US>Nel</span>终止，而不是<span lang=EN-US>Unix</span>标准<span lang=EN-US>LF</span>，这将被报告。还将识别包含嵌入转义序列或过度醒目的文件。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>一旦文件确定了在文本类型文件中使用的字符集，它将试图确定该文件是用哪种语言编写的。语言测试寻找特定的字符串<span
lang=EN-US>(Cf. #include&lt;names.h&gt;)</span>，它可以出现在文件的前几个块中的任何地方。例如，关键字<span
lang=EN-US>.br</span>表示文件很可能是<span lang=EN-US>troff(1)</span>输入文件，正如关键字<span
lang=EN-US>struct</span>表示<span lang=EN-US>C</span>程序一样。这些测试不如前两组可靠，因此它们是最后执行的。语言测试例程还测试一些混类<span
lang=EN-US>(</span>例如<span lang=EN-US>tar(1)</span>存档<span lang=EN-US>)</span>。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>任何无法标识为已在上述任何字符集中写入的文件，都被简单地称为<span
lang=EN-US>“data”</span>。</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>4</span></b><b><span style='font-family:
"Microsoft YaHei"'>、环境变量</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>环境变量<span lang=EN-US>MAGIC</span>可以用来设置默认的魔术文件名。如果设置了该变量，那么文件将不会尝试打开<span
lang=EN-US>$HOME/.magic</span>。文件酌情将<span lang=EN-US>‘.mgc’</span>添加到此变量的值中。环境变量<span
lang=EN-US>POSIXLY_RIDER</span>控制<span lang=EN-US>(</span>在支持符号链接的系统上<span
lang=EN-US>)</span>，文件是否会尝试遵循符号链接。如果设置了，那么文件将遵循符号链接，否则就不会。这也是由<span lang=EN-US>-l</span>和<span
lang=EN-US>-h</span>选项控制的。</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>5</span></b><b><span style='font-family:
"Microsoft YaHei"'>、返回值</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
style='font-family:"Microsoft YaHei"'>文件在成功时返回<span lang=EN-US>0</span>，在错误时返回非零。如果文件操作数命名的文件不存在，无法读取，或者无法确定由文件操作数命名的文件的类型，则不认为这是影响退出状态的错误。</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>6</span></b><b><span style='font-family:
"Microsoft YaHei"'>、文件</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>/usr/share/misc/magic.mgc</span><span
style='font-family:"Microsoft YaHei"'>，默认已编译魔术列表。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>/usr/share/misc/magic</span><span
style='font-family:"Microsoft YaHei"'>，包含默认魔术文件的目录。</span></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><b><span lang=EN-US
style='font-family:"Microsoft YaHei"'>3</span></b><b><span style='font-family:
"Microsoft YaHei"'>、实例</span></b></p>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>1</span><span
style='font-family:"Microsoft YaHei"'>）直接查看文件 </span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]# <b>file 1.c</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><b><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>1.c: ASCII text        
  //</span></b></code><code><b><span style='font-size:10.0pt;line-height:200%;
  font-family:DengXian'>默认分隔符是冒号</span></b></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]#<b> file -F , 1.c         //</b></span></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>指定分隔符为逗号</span></b></code></p>
  <p class=MsoNormal style='line-height:200%'><code><b><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>1.c, ASCII text</span></b></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>2</span><span
style='font-family:"Microsoft YaHei"'>）从给定文件中读取文件名，然后进行操作 </span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]#<b> cat 1.c</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>2.c</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>3.c</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>&nbsp;</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>[root@localhost
  weijie]#<b> file -f 1.c         //</b></span></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>从</span></b></code><code><b><span
  lang=EN-US style='font-size:10.0pt;line-height:200%;font-family:Menlo'>1.c</span></b></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>读取文件内容，将他们作为文件名重新进行</span></b></code><code><b><span
  lang=EN-US style='font-size:10.0pt;line-height:200%;font-family:Menlo'>file</span></b></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>操作。</span></b></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>2.c: ASCII text</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>3.c: ASCII text</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>3</span><span
style='font-family:"Microsoft YaHei"'>）读取特殊文件的类型</span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>$ <b>file -s
  /dev/wd0{b,d}</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/wd0b: data</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/wd0d: x86
  boot sector</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>$ <b>file -s
  /dev/hda{,1,2,3,4,5,6,7,8,9,10}</b></span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda:   x86
  boot sector</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda1: 
  Linux/i386 ext2 filesystem</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda2:  x86
  boot sector</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda3:  x86
  boot sector, extended partition table</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda4: 
  Linux/i386 ext2 filesystem</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda5: 
  Linux/i386 swap file</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda6: 
  Linux/i386 swap file</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda7: 
  Linux/i386 swap file</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda8: 
  Linux/i386 swap file</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda9:  empty</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda10: empty</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='text-indent:21.0pt;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>4</span><span
style='font-family:"Microsoft YaHei"'>）以<span lang=EN-US>MIME</span>格式输出 </span></p>

<table class=a0 border=1 cellspacing=0 cellpadding=0 width="95%"
 style='width:95.0%;margin-left:24.1pt;border-collapse:collapse;border:none'>
 <tr style='height:14.9pt'>
  <td width=836 valign=top style='width:836.15pt;border:solid windowtext 1.0pt;
  background:#E7E6E6;padding:0cm 5.4pt 0cm 5.4pt;height:14.9pt'>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>$<b> file -i
  file.c file /dev/{wd0a,hda}           //</b></span></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>输出</span></b></code><code><b><span
  lang=EN-US style='font-size:10.0pt;line-height:200%;font-family:Menlo'>MIME</span></b></code><code><b><span
  style='font-size:10.0pt;line-height:200%;font-family:DengXian'>类型</span></b></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>file.c:     
  text/x-c</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>file:       
  application/x-executable</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/hda:   
  application/x-not-regular-file</span></code></p>
  <p class=MsoNormal style='line-height:200%'><code><span lang=EN-US
  style='font-size:10.0pt;line-height:200%;font-family:Menlo'>/dev/wd0a:  
  application/x-not-regular-file</span></code></p>
  </td>
 </tr>
</table>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal style='line-height:200%'><span lang=EN-US style='font-family:
"Microsoft YaHei"'>&nbsp;</span></p>

<p class=MsoNormal align=center style='text-align:center;line-height:200%'><span
lang=EN-US style='font-family:"Microsoft YaHei"'>Copyright@david 
zhytwj2018@163.com</span></p>

</div>

</body>

</html>
